<!--分红结算政策列表-->
<template>
  <div>
    <f-table ref='table' rowKey='policyBonusId' :showSetting='false' setting-key='bonus_tab1' :tableColumns='columns' :scroll='{x:true}' :showMultipleBtn='false' :operator='operator' :multiple='multiple' :params='queryParam' :api='api.bpb'>
      <span slot='action' slot-scope='text, record'>
          <template>
            <a href='javascript:;' @click='$refs.form.openModal(record)'>编辑</a>
            <a-divider type='vertical' />
             <a-dropdown>
                <a class='ant-dropdown-link'>更多 <a-icon type='down' /></a>
                <a-menu slot='overlay'>
                   <a-menu-item>
                    <a href='javascript:;'>停用</a>
                  </a-menu-item>
                </a-menu>
              </a-dropdown>
          </template>
        </span>
    </f-table>
    <policy-bonus-form ref='form' @success='onSuccess' :policyDrugId='queryParam.policyDrugId'></policy-bonus-form>
  </div>
</template>
<script>
import api from "../../../../js/api"
import PolicyBonusForm from "./policy_bonus_form"

export default {
  name: "PolicyListBonus",
  components: { PolicyBonusForm },
  data() {
    let me = this
    //操作按钮
    let operator = []
    operator.push({
      name: "添加政策",
      icon: "plus",
      that: this,
      handler: (table, that) => {
        this.$refs.form.openModal()
      }
    })
    return {
      api: Object.assign(api, this.api),
      multiple: false,
      deptId: "",
      //列表初始化查询参数
      queryParam: {
        auth: 1,
        policyDrugId:null,
      },
      params1: {
        deptId: ""
      },
      columns: [
        {
          title: "序号",
          width: "60px",
          align: "left",
          customRender: (text, record, index) => index + 1
        },
        {
          title: "部门名称",
          align: "center",
          dataIndex: "deptName"
        },
        {
          title: "业务员",
          align: "center",
          dataIndex: "saleManName"
        },
        {
          title: "提成金额",
          align: "center",
          dataIndex: "bonusAmount"
        },
        {
          title: "执行日期",
          align: "center",
          dataIndex: "beginDate"
        },
        {
          title: "结束日期",
          align: "center",
          dataIndex: "endDate"
        },
        {
          title: "备注",
          align: "center",
          dataIndex: "remark"
        }, {
          title: "操作",
          align: "center",
          width: "110px",
          dataIndex: "action",
          scopedSlots: { customRender: "action" }
        }
      ],
      operator: operator
    }
  },
  created() {
  },
  methods: {
    setData(data) {
      //设置列表初始查询条件
      this.queryParam.policyDrugId = data.policyDrugId
      this.$refs.table.refresh(false)
    },
    onSuccess() {
      this.$refs.table.refresh()
    },
    /**
     * 查询事件
     * @param searchParams
     */
    searchTable(searchParams) {
      this.queryParam = Object.assign(this.queryParam, searchParams)
      this.$refs.table.refresh(true, searchParams)
    },
    /**
     * 刷新列表
     */
    onLoad() {
      this.$refs.table.refresh()
      this.$emit("changeTab")
    }
  }
}
</script>